﻿<Window x:Class="Catel.Examples.AdvancedDemo.Views.LogicInBehavior.DemoWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:viewmodels="clr-namespace:Catel.Examples.AdvancedDemo.ViewModels"
        xmlns:catel="http://catel.codeplex.com"
        SizeToContent="WidthAndHeight" ShowInTaskbar="False"
        Title="{Binding Title}">

    <i:Interaction.Behaviors>
        <!-- Note that Click is default, and thus can be left out if you want -->
        <catel:WindowBehavior x:Name="mvvmBehavior" ViewModelType="viewmodels:DemoWindowViewModel"
                                      Save="saveButton" SaveAndClose="saveAndCloseButton"
                                      Cancel="cancelButton" CancelAndClose="cancelAndCloseButton"
                                      Close="closeButton.Click" />
    </i:Interaction.Behaviors>

    <catel:InfoBarMessageControl>
        <Grid>
            <catel:WarningAndErrorValidator Source="{Binding}" />

            <catel:StackGrid>
                <catel:StackGrid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </catel:StackGrid.RowDefinitions>

                <catel:StackGrid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </catel:StackGrid.ColumnDefinitions>

                <Label Content="First name" />
                <TextBox Text="{Binding FirstName, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" />

                <Label Content="Middle name" />
                <TextBox Text="{Binding MiddleName, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" />

                <Label Content="Last name" />
                <TextBox Text="{Binding LastName, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" />
                
                <WrapPanel Grid.ColumnSpan="2" Style="{StaticResource RightAlignedButtonsWrapPanelStyle}">
                    <Button x:Name="saveButton" Content="Save" Style="{StaticResource RightAlignedFixedSizeButtonStyle}" />
                    <Button x:Name="saveAndCloseButton" Content="Save &amp; close" Style="{StaticResource RightAlignedFixedSizeButtonStyle}" />
                    <Button x:Name="cancelButton" Content="Cancel" Style="{StaticResource RightAlignedFixedSizeButtonStyle}" />
                    <Button x:Name="cancelAndCloseButton" Content="Cancel &amp; close" Style="{StaticResource RightAlignedFixedSizeButtonStyle}" />
                    <Button x:Name="closeButton" Content="Close" Style="{StaticResource RightAlignedFixedSizeButtonStyle}" />
                </WrapPanel>
            </catel:StackGrid>
        </Grid>
    </catel:InfoBarMessageControl>
</Window>
